﻿using System;

namespace Sissonix.ExtRest
{
    /// <summary>
    /// HTTP methods
    /// </summary>
    public static class HttpMethods
    {
        /// <summary>
        /// Enumeration of HTTP methods
        /// </summary>
        public enum Method
        {
            DELETE,
            GET,
            HEAD,
            OPTIONS,
            POST,
            PUT,
            NotHandled
        }

        /// <summary>
        /// Parses the type of the HTTP method.
        /// </summary>
        /// <param name="requestType">Type of the request.</param>
        /// <returns>HTTP method enumeration member.</returns>
        public static Method ParseHttpMethodType(string requestType)
        {
            if (Enum.IsDefined(typeof(Method), requestType))
            {
                return (Method)Enum.Parse(typeof(Method), requestType);
            }
            return Method.NotHandled;
        }
    }
}